import axios from 'axios';
// 获取商品表单头
let type_header = (params) => axios.get('/product/product/type_header', { params });
// 商品列表
let product = (params) => axios.get('/product/product', { params });
// 选择商品列表
let product_list = (params) => axios.get('/product/category/tree/1', { params });
// 商品导出
let storeProduct = (params) => axios.get('/export/storeProduct', { params });
// 商品详情
let product_detail = (params) => axios.get(`/product/product/${params}`);
// 获取规则属性模板
let get_rule = (params) => axios.get('/product/product/get_rule', { params });
// 获取运费模板
let get_template = (params) => axios.get('/product/product/get_template', { params });
//商品上下架操作
let set_show=(id,is_show) => axios.put(`/product/product/set_show/${id}/${is_show}`);
//批量下架
let product_unshow=(data) => axios.put('/product/product/product_unshow',data);
// 生成属性
let generate_attr = (id,data) => axios.post(`/product/generate_attr/${id}`, data);
// 保存新增或编辑
let save_product = (id,data) => axios.post(`/product/product/${id}`, data);
// 批量设置
let batch_setting = (data) => axios.post('/product/batch/setting', data);
//商品加入/移除回收站
let remove_product = (id) => axios.delete(`/product/product/${id}`);
// 添加优惠券
let mark = (params) => axios.get('/marketing/coupon/released', { params });


// .....商品分类.....
// 分类列表
let get_product_category = (params) => axios.get('/product/category', { params });
// 树形列表
let category_tree = (params) => axios.get(`/product/category/tree/${params}`);
// 新增表单
let create_category = (params) => axios.get('/product/category/create',{params});
// 分类添加
let category_add = (data) => axios.post('/product/category', data);
//修改状态
let category_set_show=(id,is_show) => axios.put(`/product/category/set_show/${id}/${is_show}`);
// 编辑表单
let create_category_edit = (id) => axios.get(`/product/category/${id}`);
//分类编辑
let category_edit=(id,data) => axios.put(`/product/category/${id}`,data);
// 分类删除
let remove_category = (params) => axios.delete(`/product/category/${params}`);


// ....商品规格....
// 列表
let product_rule = (params) => axios.get('/product/product/rule', { params });
// 规则详情
let product_rule_info = (params) => axios.get(`/product/product/rule/${params}`);
// 保存新建或编辑
let save_product_rule = (id,data) => axios.post(`/product/product/rule/${id}`, data);
// 分类删除
let remove_product_rule = (params) => axios.delete('/product/product/rule/delete',{params});

// ....商品评论....
// 商品评论列表
let product_reply = (params) => axios.get('/product/reply', { params });
// 虚拟评论表单
let product_fictitious_reply = (params) => axios.get(`/product/reply/fictitious_reply/${params}`);
// 评论商品列表
let reply_product_list = (params) => axios.get('/product/product/list', { params });
//回复评论
let product_set_reply=(id,data) => axios.put(`/product/reply/set_reply/${id}`,data);
// 添加虚拟评论
let save_fictitious_reply = (data) => axios.post('/product/reply/save_fictitious_reply', data);
// 删除评论
let remove_reply = (params) => axios.delete(`/product/reply/${params}`);
export default{
    type_header,
    product,
    product_list,
    set_show,
    product_detail,
    get_rule,
    get_template,
    generate_attr,
    save_product,
    storeProduct,
    batch_setting,
    remove_product,
    mark,
    product_unshow,

// 商品分类
    get_product_category,
    category_tree,
    create_category,
    category_add,
    category_set_show,
    create_category_edit,
    category_edit,
    remove_category,

    // 商品规格
    product_rule,
    product_rule_info,
    save_product_rule,
    remove_product_rule,

    // 商品评论
    product_reply,
    product_fictitious_reply,
    reply_product_list,
    product_set_reply,
    save_fictitious_reply,
    remove_reply,
}